# $Id: Makefile,v 2.1.0.21 1998/02/17 20:13:59 sauderd Exp $

# This code was developed with the support of the United States Government,
# and is not subject to copyright.

MAKE_RULES =  ../../make_rules
include $(MAKE_RULES)

PDES = ../../..


###############################################################

#  This Makefile builds the SCL editor and stepcore library.  The
#  library can be made as a whole or in two parts: the editor and the
#  stepcore.  All files below this point are made using relative paths
#  based on the PDES and LIBRARY macro.  The make_rules file specifies
#  which compiler and preprocessors will be used.

LIBRARY = ../../lib/libCedcore.a

###############################################################


CORE		= $(PDES)/src/clstepcore
DAI		= $(PDES)/src/cldai
SCL_EDITOR	= $(PDES)/src/cleditor
UTILS		= $(PDES)/src/clutils
TEST_DIR	= $(PDES)/src/test

PDESINCLUDES =	-I$(SCL_EDITOR) \
		-I$(CORE) \
		-I$(DAI) \
		-I$(UTILS)

INCLUDES =	-I../.. $(MR_INCLUDES) \
		$(PDESINCLUDES) 

CORE_FILES = \
	sdaiApplication_instance.o \
	STEPcomplex.o \
	STEPattribute.o \
	STEPattribute.inline.o \
	sdai.o \
	sdaiEnum.o \
	sdaiString.o  \
	sdaiSelect.o \
	sdaiBinary.o  \
	STEPaggregate.o \
	STEPundefined.o	\
	STEPattributeList.o \
	SingleLinkList.o	\
	SingleLinkList.inline.o \
	Registry.inline.o	\
	ExpDict.o	\
	ExpDict.inline.o \
	read_func.o \
	collect.o     \
	complexlist.o \
	entlist.o     \
	multlist.o    \
	orlist.o      \
	entnode.o     \
 	non-ors.o     \
	match-ors.o   \
	trynext.o     \
	print.o

EDITOR_FILES = \
	mgrnode.o \
	mgrnodelist.o \
	dispnode.o \
	dispnodelist.o \
	mgrnodearray.o \
	cmdmgr.o \
	instmgr.o \
	s_HEADER_SCHEMA.o   \
	s_HEADER_SCHEMA.init.o	\
	STEPfile.o	\
	STEPfile.inline.o

METAFILES = \
	$(CORE_FILES) \
	$(EDITOR_FILES)

STUB_FILES = ../../lib/needFunc.o ../../lib/p21read.o

%.o::  $(CORE)/%.cc  
	@echo " "
	@echo "compiling $< from CORE dir";
	$(CXX) $(CFLAGS)  $(INCLUDES)  -c $<;

%.o::  $(SCL_EDITOR)/%.cc  
	@echo " "
	@echo "compiling $< from SCL_EDITOR dir";
	$(CXX) $(CFLAGS)  $(INCLUDES)  -c $<;

%.o::  $(TEST_DIR)/%.cc  
	@echo " "
	@echo "compiling $< from TEST_DIR";
	$(CXX) $(CFLAGS)  $(INCLUDES) -I$(TEST_DIR) -c $<;

#  make the library and the stubs
all: lib stub

lib: $(LIBRARY)

#			make the whole library
$(LIBRARY): $(METAFILES)
	@echo " "
	@echo "making $(LIBRARY)"
	echo "ar rc $(LIBRARY) $?"; \
	ar rc $(LIBRARY) $?; \
	echo "$(RANLIB) $(LIBRARY)"; \
	$(RANLIB) $(LIBRARY);

#			make only the core half of the library
stepcore: $(CORE_FILES)
	@echo " "
	@echo "making stepcore part of $(LIBRARY)"
	echo "ar rc $(LIBRARY) $?"; \
	ar rc $(LIBRARY) $?; \
	echo "$(RANLIB) $(LIBRARY)"; \
	$(RANLIB) $(LIBRARY);

#			make only the editor half of the library
editor: $(EDITOR_FILES)
	@echo " "
	@echo "making editor part of $(LIBRARY)"
	echo "ar rc $(LIBRARY) $?"; \
	ar rc $(LIBRARY) $?; \
	echo "$(RANLIB) $(LIBRARY)"; \
	$(RANLIB) $(LIBRARY);

test:	lib stub
	cd $(TEST_DIR); $(MAKE) all

../../lib/p21read.o:	$(TEST_DIR)/p21read/p21read.cc  
	@echo " "
	@echo "compiling p21read.cc from TEST_DIR";
	$(CXX) $(CFLAGS)  $(INCLUDES) -I$(TEST_DIR) -c $(TEST_DIR)/p21read/p21read.cc;
	cp p21read.o ../../lib

../../lib/needFunc.o:	$(TEST_DIR)/needFunc.cc
	@echo " "
	@echo "compiling needFunc.cc from TEST_DIR";
	$(CXX) $(CFLAGS)  $(INCLUDES) -I$(TEST_DIR) -c $(TEST_DIR)/needFunc.cc;
	cp needFunc.o ../../lib

#  stubs for using the STEP Class Library without the Data Probe 
stub:	$(STUB_FILES) 

clean:
	rm $(STUB_FILES) $(METAFILES) $(LIBRARY)
 
build:	checkout all

checkout:
	cd $(CORE); co checkout; checkout;
	cd $(SCL_EDITOR); co checkout; checkout;

depend:
	$(MAKE_DEPEND) $(MR_COND_DEFS) $(CPLUSINCLUDES) $(INCLUDES) $(CORE)/*.cc $(SCL_EDITOR)/*.cc

#
# dependencies generated by makedepend
#

# DO NOT DELETE THIS LINE -- make depend depends on it.
